﻿// This File is part of Innovation Foundry's "QualityHelper Project"
//
// Copyright  2009 Innovation Foundry Pty Ltd
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the
// Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA  02110-1301 USA
// or alternatively it may be downloaded from <http://www.gnu.org/licenses/>.

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Globalization;

namespace InnovationFoundry.QualityHelper.Silverlight.Utilities
{
    public static class ColorHelper
    {
        public static Color GetColor(string ColorCode)
        {
            Color result = Colors.Transparent;

            if (ColorCode.IndexOf('#') == 0)
            {
                result = Color.FromArgb(
                byte.Parse(ColorCode.Substring(1, 2), NumberStyles.HexNumber),
                byte.Parse(ColorCode.Substring(3, 2), NumberStyles.HexNumber),
                byte.Parse(ColorCode.Substring(5, 2), NumberStyles.HexNumber),
                byte.Parse(ColorCode.Substring(7, 2), NumberStyles.HexNumber));
            }
            return result;

        }
    }
}
